<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <div>
            <input type="text" v-model="username" id=""> {{ username }}
        </div>
        <div>
            <input type="password" v-model="password" id=""> {{ password }}
        </div>
        <div>
            <!-- attributes --- 属性(如果属性的值是变量，boolean类型或者是number类型，需要使用 绑定属性 -- v-bind)< -->
            <input type="radio" name="sex" v-model="sex" :value="1"> 男 {{ sex === 1 ? '男': '女'}} 
            <input type="radio" name="sex" v-model="sex" :value="0"> 女 {{ sex === 1 ? '男': '女'}}
        </div>
        <div>
            <input type="checkbox" name="hobby" v-model="hobby" value="足球">足球
            <input type="checkbox" name="hobby" v-model="hobby" value="篮球">篮球
            <input type="checkbox" name="hobby" v-model="hobby" value="排球">排球
        </div>
        <div>
            <input type="number" v-model.number="age"> {{age}}
        </div>
        <div>
            <label>阶段</label>
                <select v-model="lesson">
                    <option disabled value="">请选择</option>
                    <option value="1">一阶段</option>
                    <option value="2">二阶段</option>
                    <option value="3">三阶段</option>
                </select> ---- {{ lesson }}
            <label>备注</label>
            <textarea v-model="note"></textarea>{{note}}
        </div>
        <input type="checkbox" v-model="flag">同意**协议
        <button :disabled="!flag" @click="getData">获取数据</button>
    </div>
</body>
<script>
    const app = new Vue({
        el: '#app',
        data: {
            username : '张三',
            password: '123456',
            sex: 1,
            hobby: [],
            flag:false,
            age: 0,
            lesson: 0,
            note:'',
        },
        methods: {
            getData() {
                console.log({
                    username: this.username,
                    password: this.password,
                    sex: this.sex,
                    hobby: this.hobby,
                    lesson: this.lesson,
                    note: this.note,
                    age: typeof this.age
                })
            }
        }
    });
</script>
</html>